a t e v a n s . c o m

(╯°□°)╯︵ <ǝlqɐʇ/>

Best way to serve your Jekyll blog out of an S3 bucket, via Nginx:

        server {
                  listen  80;
                  server_name sitename.com;
        
                  access_log /var/dir/access.log;
                  error_log /var/dir/error.log;
                  rewrite_log on;
                  error_page 404 = @fallback-2;
                  error_page 500 https://jekyllhub.com/errors/error_500;
        
                  location / {
                    # match anything with an extension
                    rewrite /[^/]*\.\w+$  "/sitename${uri}?" break;        
                    
                    # ending in normal word
                    rewrite /\w+$      "/sitename${uri}/index.html?" break;
                    
                    # ending in /
                    rewrite /$         "/sitename${uri}index.html?" break;
                    
                    # catch all
                    rewrite ^          "/sitename${uri}?" break;
        
                    proxy_pass http://bucket.s3.amazonaws.com;
                    proxy_intercept_errors on;
                    index index.html;
                  }

                  location @fallback-2 {
                     access_log /var/dir/fallback.log;
                     error_page 404 https://jekyllhub.com/errors/error_404;
                     
                     # no dir with this name, try file
                     # note your req path here is WHAT YOU REWROTE IT TO in the first req
                     rewrite ^/sitename/(.*)/index.html$  "/sitename/$1.html" break;
                     proxy_intercept_errors on;
                     proxy_pass http://bucket.s3.amazonaws.com;
                  }
        }

Setting up my blog with Jekyll, I wanted to proxy it from S3 through Nginx. However, it took me a while to get the urls right - I wanted /page2 to work even though page2 is just a directory with a /index.html , and I wanted /about to point to about.html in the root directory.

My solution was to try the directory version first, catch the 404, and try to rewrite again on fallback. One thing the Nginx docs didn’t make clear is that when you call rewrite and catch 404 with a fallback, the uri / path is no longer what the original request was, but is now what you rewrote it to. So if you want to rewrite again, you have to account for that.

Hope this helps someone.

One day, you take a job as a associate producer on a sitcom in Los Angeles. You think this is the break you needed to get your foot in the door. You’ll be able to do standup shows at night, and work as a producer during the day. Then a few months or so later, you’ll be able to quit your producer job and become a full-time standup comedian.

Question:

I want to see the :hover style for an anchor I’m hovering on in Chrome. In Firebug, there’s a Style dropdown that allows me to select the different states for an element. I can’t seem to find anything similar in Chrome. Am I missing something?

Answer:

Now you can see both the psuedo-class rules and force them on elements.

To see the rules like :hover in the Styles pane click the small dotted box button in the top right.

To force an element into :hover state, right click it.

via StackOverFlow

gist: 4199131

via Github Gists

Made this to easily turn a collection into a grid view via Bootstrap. Just drop into your application_helper.rb and have fun!

But the de facto leader of the house (the one who cooked both dinner and breakfast while I was there) is Evans, an affable, bearded man who had lost his job at a San Francisco social gaming platform earlier this year. He moved down to the gulf coast of Costa Rica for a month, and later back home to Maryland, before relocating to Kansas City.

Jcrop is the quick and easy way to add image cropping functionality to your web application. It combines the ease-of-use of a typical jQuery plugin with a powerful cross-platform DHTML cropping engine that is faithful to familiar desktop graphics applications.

Pretty useful.

        development:
          code: "UA-12345678-1"
        
        test:
          code: "UA-fakefake-1"
        
        production:
          code: "UA-12345678-1"

Hint: don’t use code as a hash key. Psych really did not like this:

I cannot say enough great things about The Spriters Resource. It’s a website where you can search through all the various gaming systems for sprite sheets. These can include maps, buildings, menu screens, character sprites, icons, and pretty much anything!

        find `pwd` -type f -print | xargs sed -i '' -e 's/RailsBootstrap/Iconizer/g'

I’m surprised at how rarely I have to do this sort of thing. I guess Rails doesn’t often need a ton of refactoring. But yeah, useful for changing the app name after cloning a rails bootstrappy thing.

Mastodon